#include "testlib.h"
#include <stdio.h>
#define N 110
int u[N][N];
int main(int argc, char * argv[])
{
    registerTestlibCmd(argc, argv);
    int n, i, j, a, b, s;
	n=inf.readInt();
	for(i=0; i<=n; i++)
	{
		for(s=0, j=0; j<(n+2)/2; j++)
		{
			a=ouf.readInt();
			b=ouf.readInt();
			if(a<0 || a>n || b<0 || b>n) quitf(_pe, "numbers must be in range %d, %d", 0, n);
			if(u[a][b] || u[b][a]) quitf(_wa, "every domino must be used exactly once");
			s+=a+b;
			u[a][b]=1;
		}
		if(s!=n*(n+2)/2) quitf(_wa, "the sum of the %d-th row is %d, expected %d", i+1, s, n*(n+2)/2);
	}
	quitf(_ok, "%d dominoes with row sum %d", (n+1)*(n+2)/2, n*(n+2)/2);
}